<!-- <template>
  <div class="wrap" style="height:100vh">
    <el-button type="primary" style="margin-bottom: 20px">
			更新
		</el-button>
		<el-button type="primary">
			撤销更改
		</el-button>
    <div class="editor-container">
      <json-editor ref="jsonEditor" v-model="value"></json-editor>
    </div>
  </div>
</template>

<script>
	import JsonEditor from '@/components/JsonEditor'
	const jsonData = '[{"items":[{"market_type":"forexdata","symbol":"XAUUSD"},{"market_type":"forexdata","symbol":"UKOIL"},{"market_type":"forexdata","symbol":"CORN"}],"name":""},{"items":[{"market_type":"forexdata","symbol":"XAUUSD"},{"market_type":"forexdata","symbol":"XAGUSD"},{"market_type":"forexdata","symbol":"AUTD"},{"market_type":"forexdata","symbol":"AGTD"}],"name":"贵金属"},{"items":[{"market_type":"forexdata","symbol":"CORN"},{"market_type":"forexdata","symbol":"WHEAT"},{"market_type":"forexdata","symbol":"SOYBEAN"},{"market_type":"forexdata","symbol":"SUGAR"}],"name":"农产品"},{"items":[{"market_type":"forexdata","symbol":"UKOIL"},{"market_type":"forexdata","symbol":"USOIL"},{"market_type":"forexdata","symbol":"NGAS"}],"name":"能源化工"}]'
	export default {
	  name: 'jsonEditor-demo',
	  components: { JsonEditor },
	  data() {
	    return {
	      value: JSON.parse(jsonData)
	    }
	  }
	}
</script>

<style scoped>
	.editor-container{
	  position: relative;
	  height: 100%;
	}
</style> -->
<template>
	<div class="wrap">
		<el-button type="primary" style="margin-bottom: 20px" @click="updateData">
			更新
		</el-button>
		<el-button type="primary">
			撤销更改
		</el-button>
		<editor :content="jsonValue" height="100vh" theme="monokai" lang="json" ref="editor"></editor>
	</div>

</template>

<script>
	import editor from 'ace-vue2'
	import 'brace/mode/javascript'
	import 'brace/mode/json'
	import 'brace/theme/chrome'
	import 'brace/theme/monokai'
  export default {
		data(){
			return {
				jsonValue: '',
				value: ''
			}
		},
		components: {
			editor
		},
		methods: {
			updateData(){
				console.log(this.$refs.editor.getValue())
			}
		}
  }
</script>

<style lang="scss">
	.ace_editor.ace-monokai.ace_dark{
		font-size: 14px;
	}
</style>
